package com.yupi.aicodehelper.ai;

import com.yupi.aicodehelper.ai.guardrail.SafeInputGardRail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;

import java.util.List;

//@AiService
@InputGuardrails({SafeInputGardRail.class})
public interface AiCodeHelperService {

    @SystemMessage(fromResource = "system-prompt.txt")//可以指定文件路径，里面写系统提示词
    String chat(String userMessage);

    @SystemMessage(fromResource = "system-prompt.txt")
    Report chatFormReport(String userMessage);

    //学习报告
    //record用于简洁地声明不可变数据载体
    record Report(String name, List<String> suggestionList){};

    //返回封装后的结果
    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);

    //流式输出
    @SystemMessage(fromResource = "system-prompt.txt")
    Flux<String> chatStream(@MemoryId int MemoryId, @UserMessage String message);
}
